<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        li:first-child{
            /* background: red; */
        }
        li:last-child{
            /* background: blue; */
        }
        li:nth-child(2){
            /* background: pink; */
        }
        /* li:nth-last-child(2){ */
        /* n是从0开始的自动增长值 */
        li:nth-child(3n+1){
            /* background: pink; */
        }

        /* even偶数、odd奇数 */
        li:nth-child(odd){
            background-color: pink;
        }

        span:only-child{
            background: red;
        }
    </style>
</head>
<body>
    <ul>
        <li>li1</li>
        <li>li2</li>
        <li>li3</li>
        <li>li4</li>
        <li>li5</li>
        <li>li6</li>
        <li>li7</li>
        <li>li8</li>
    </ul>

    <div>
        <p>111</p>
        <span>222</span>
    </div>
</body>
</html>